/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cxhd.lis.ctrl;

import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

/**
 *
 * @author 52461
 */
@ControllerBind(controllerKey = "/view/reagent")
public class ReagentCtrl extends Controller {

    public void index() {
        render("/view/reagent/reagent.jsp");
    }
    
       public void saveReagent() {
        Record rd = new Record();
        rd.set("NAME", getPara("NAME"));
        rd.set("COMPANY", getPara("COMPANY"));
         rd.set("BATCH_NUMBER", getPara("BATCH_NUMBER"));
        rd.set("DEVICE", getPara("DEVICE"));
        Db.save("zk_reagent", rd);
       
        renderText("true");
    }

    public void getReagent() {
        renderJson(Db.find("select * from zk_reagent"));
    }
    
    public void getDevice() {
        renderJson(Db.find("select * from lis_deviceset"));
    }
    
    public void deleteReagent() {
       Db.update("delete from zk_reagent where PK="+getPara("PK"));
        renderText("true");
    }
}
